package com.zhengsr.latte.app;

import android.content.Context;
import android.os.Handler;

/**
 * Created by zhengshaorui on 2018/3/5.
 */

public final class Latte {

    /**
     * @param context
     * @return
     */
    public static Configurator init(Context context){
        Configurator.Holder.getInstance().getLatteConfigs()
                .put(ConfigType.APPLICATION_CONTEXT.name(),context);
        return Configurator.Holder.getInstance();
    }


    public static <T> T getConfigurator(Object key){
        return (T) Configurator.Holder.getInstance().getLatteConfigs().get(key);
    }

    public static Context getApplication(){
        return getConfigurator(ConfigType.APPLICATION_CONTEXT.name());
    }

    public static Handler getHandler(){
        return getConfigurator(ConfigType.HANDLER.name());
    }

}
